package com.xjtu.platform.security.infomanage.dao;

import com.xjtu.platform.security.infomanage.InfoManageDto;
import com.xjtu.platform.security.infomanage.RecordModel;
import org.apache.ibatis.annotations.*;

import javax.sound.sampled.Line;
import java.util.List;
@Mapper
public interface InfoManageDao {

    @Insert("insert into user(user_id,user_name,user_age,email) values(#{user_id},#{user_name},#{user_age},#{email})")
    void insertInfo(InfoManageDto dto);
    @Select("insert into user_role(user_role_id,user_id,role_id) values(#{user_role_id},#{user_id},#{role_id})")
    void insertRole(InfoManageDto dto);

    @Update("update user set user_name = #{user_name},user_age = #{user_age},email = #{email} where user_id = #{user_id}")
    void changeInfo(InfoManageDto dto);

    @Select("select * from user where user_id in (select user_id from user_role where role_id = #{role_id})")
    List<RecordModel> getInfo(InfoManageDto dto);

    @Delete("delete from user_role where user_id = #{user_id}")
    void deleteInfo(InfoManageDto dto);

    @Select("select count(*) from user_role")
    int Count();
}
